#!/usr/bin/python
# -*-coding: UTF-8 -*-
"""
# Time: 2025/3/25 15:24
# @Project_name: PROJECT_NAME
"""

dicts = {}
dicts = {'庄子': '道家', '墨子': '墨家', '孔子': '儒家'}
print(f'输出字典：{dicts}')
print("类型：", type(dicts))

# 增加键值对，有则更新，无则新增
dicts['孟子'] = '儒家'
dicts['孟子'] = '道家'
# 有则更新，无则插入
dicts.update({'孟子': '儒家'})
print(dicts)

del dicts['孟子']
print("删除一个元素后的字典：", dicts)

print("~~~~~~~~~~~~~~字典的遍历~~~~~~~~~~~~~~~")
# 得到key组成的列表
keys = dicts.keys()
print("得到所有key组成的列表：", keys)
values = dicts.values()
print("得到所有values组成的列表：", values)

thinks = dicts.get("庄子")
print("庄子思想：", thinks)
print("墨子思想: ", dicts["墨子"])

for key, value in dicts.items():
    print(f"姓名：{key}", f"思想: {value}")


